package com.weiiew.common.entity.qo;

import lombok.Data;

import java.util.Objects;

/**
 * @Description
 * @Author 魏锴
 * @Date 2024/9/8
 */
@Data
public class BuildingQo implements QoInter {
    /**
     * 搜索建筑名
     */
    private String name;
    /**
     * 建筑种类编号
     */
    private Integer type;
    /**
     * 版本号
     */
    private Integer version;
    /**
     * 限制数量
     */
    private Integer limit;
    /**
     * 偏移量
     */
    private Integer offset;
    @Override
    public boolean check() {
        return limit != null && offset != null && limit > 0 && offset >= 0 && version != null;
    }

    @Override
    public void format() {
        if (Objects.equals(this.name, "")) this.name = null;
    }

    public String getHasPageKey() {
        return version + "&" + name + "&" + type + "&" + limit + "&" + offset;
    }
    public String getNoPageKey(){
        return version + "&" + name + "&" + type;
    }
}
